<%@ page contentType="text/html;charset=utf-8" language="java"
	pageEncoding="UTF-8" import="java.util.Date"%>
<%@include file="../common/mastertopedit.jsp"%>
<script type="text/javascript" src="${ctx}/js/region.js"></script>
<input type="hidden" id="userId" value="${model.userOpen.id}">
<div class="form-horizontal pt-15  form-clean-magin" id="content">
	<div class="form-group">
		<label for="inputEmail3"
			class="col-xs-3 text-right control-label usual-label">所属门店</label>
		<div class="col-xs-9">
			<select name="shopId"
					id="shopId" class="form-control form-control-260 pull-left">
					
					<c:forEach items="${model.shopInfos}" var="lo" varStatus="itemStatus">
						<option value="${lo.id}"
							<c:if test="${model.userOpen.shopId==lo.id}">selected="selected"</c:if>>${lo.shopName}</option>
					</c:forEach>
				</select>
			<i class="plum-sign-right">*</i>
		</div>
	</div>

	<div class="form-group">
		<label for="inputEmail3"
			class="col-xs-3 text-right control-label usual-label">用户名</label>
		<div class="col-xs-9">
			<input class="form-control form-control-260 pull-left" id="usrName"
				type="text" value="${model.userOpen.usrName}"> <i
				class="plum-sign-right">*</i>
		</div>
	</div>
	
	<div class="form-group">
		<label for="inputEmail3"
			class="col-xs-3 text-right control-label usual-label">姓名</label>
		<div class="col-xs-9">
			<input class="form-control form-control-260 pull-left" id="realName"
				type="text" value="${model.userOpen.realName}"> <i
				class="plum-sign-right">*</i>
		</div>
	</div>
	
	<div class="form-group">
		<label for="inputEmail3"
			class="col-xs-3 text-right control-label usual-label">手机</label>
		<div class="col-xs-9">
			<input class="form-control form-control-260 pull-left" id="mobile"
				type="text" value="${model.userOpen.mobile}">
		</div>
	</div>
	
	<div class="form-group">
		<label for="inputEmail3"
			class="col-xs-3 text-right control-label usual-label">密码</label>
		<div class="col-xs-9">
			<input class="form-control form-control-260 pull-left" id="pwd"
				type="text" value=""> <i
				class="plum-sign-right"></i>
		</div>
	</div>
	
	

	

</div>
<div class="form-group text-center">
	<button type="button" class="runmi-btn runmi-primary"
		onclick="backIndex()">取消</button>
	<button type="button" class="runmi-btn runmi-sure-btn" onclick="save()">保存</button>
</div>

<script type="text/javascript">
	function save() {
		var postData = "&id=" + $('#userId').val();

		var shopId = $('#shopId').val();
		if (shopId == '') {
			layer.alert('请选择门店');
			return;
		}
		postData = postData + "&shopId=" + encodeURIComponent(shopId);


		var usrName = $('#usrName').val();
		if (usrName == '') {
			layer.alert('请输入用户名');
			return;
		}
		postData = postData + "&usrName=" + encodeURIComponent(usrName);

	
		var realName = $('#realName').val();
		if (realName == '') {
			layer.alert('请输入姓名');
			return;
		}
		postData = postData + "&realName=" + encodeURIComponent(realName);
		
		var mobile = $('#mobile').val();
		postData = postData + "&mobile=" + encodeURIComponent(mobile);


		var pwd = $('#pwd').val();
		postData = postData + "&pwd=" + encodeURIComponent(pwd);
	
		layer.load(1, {
			shade : [ 0.5, '#fff' ]
		});
		//alert(postData);
		$.ajax({
			type : "POST",
			url : "save",
			data : postData,
			contentType : "application/x-www-form-urlencoded;charset=UTF-8",
			async : true, // 同步  true 异步。默认是异步
			dataType : 'json',
			error : function(resultdata) {
				layer.closeAll();
			},
			success : function(resultdata) {
				layer.closeAll();
				if (resultdata.returnCode == "0000") {
					layer.alert('操作成功', {
						icon : 1
					}, function() {
						parent.editReturn();
						//layer.closeAll(); 
						//layer.closeAll();
						//window.location.href="${pageContext.request.contextPath}/distrbutor/inventory/index";
					});
				} else {
					layer.alert(resultdata.returnMessage);
				}
			}
		});
	}
	function backIndex() {
		parent.editReturn();
	}
</script>
<%@include file="../common/masterbottom.jsp"%>
